	var log = -44;
	// var log = $('#shopbasket').css('top');
	// alert(log);
	$('.btn').each(function(){ 
		
		$(this).click(function(){
			log-=44;
			$(this).parent().removeClass('block').addClass('hidden').next().removeClass('hidden').addClass('block');
			$('#shopbasket').attr('style','top:'+log+'px');

			// var id = ;$('.yincangid').val();
			
			var sid = $(this).attr('id');
			// alert(666);
			var id = $(this).val();
			
			
			// var name = $('.shopmenu-food-name.ui-ellipsis.ng-binding').html();
			// var price = $('.ng-binding.prices').html();
			// console.log(id);
			// console.log(name);
			// console.log(price);
			$.get('/shopaddas',{id:id,sid:sid},function(data){
				// console.log(JSON.parse(data)['id']);
				// console.log(data);
				// alert(data);
				var cart = JSON.parse(data);


				$(`<div class="shop-cartbasket-tablerow ng-scope" entityid="504628324">
		<div class="cell itemname ng-binding">`
           +cart['goodsname']+
          `</div>
          <div class="cell itemquantity">
           <input class="ng-pristine ng-valid" value="1" id="`+cart['id']+`">
           <span style="display:none" >`+cart['price']+`</span>
          </div>

          <div class="cell itemtotal ng-binding"  >
           &yen;`+cart['price']+
          `</div>
         </div>`).appendTo('#shopbasket');
			})
		})
	})

	$('.ctrl.plus').each(function(){ 
		$(this).click(function(){
			var num = $(this).prev().html();
			++num;
			$(this).prev().html(num);
			
			var number = $(this).prev().html(num);

			var cardId = $(this).val();
			$.get('/shopaddas',{id:cardId},function(data){
					console.log(data);
				})
			// alert($(this).val());
			// $.get('/shopadd',{number:num},function(data){
			// 	// console.log(data);
			// 	$('.ng-pristine.ng-valid').val(data);
			// 	// $('#'+cardId+).val()--;
			// })
			var nn = $('#'+cardId).val();
			nn++;
			var asd = $('#'+cardId).val(nn);

			// alert($('#'+cardId).parent().next().html());
			var count = $('#'+cardId).val() * $('#'+cardId).next().html();
			$('#'+cardId).parent().next().html(count);
			
			// $('.cell.itemtotal.ng-binding').html(count);
		})
	})

	$('.ctrl.minus').each(function(){ 
		$(this).click(function(){
			var num = $(this).next().html();
			--num;
			if (num <= 1) {
				num =1;
			}
			$(this).next().html(num);
			var number = $(this).next().html(num);
			var cardId = $(this).val();
			// alert($(this).val());
			// $.get('/shopadd',{number:num},function(data){
			// 	// console.log(data);
				
			// 	$('.ng-pristine.ng-valid').val(data);
			// })
			var nn = $('#'+cardId).val();
			nn--;
			if(nn == 0){
				nn = 1;
			}
			$('#'+cardId).val(nn);

			var count = $('#'+cardId).parent().next().html() - $('#'+cardId).next().html();
			$('#'+cardId).parent().next().html(count);
			
		})
	})

	$('#remove').click(function(){
		$('#remove').parents('#siblings').siblings().remove();
		$('.shop-cartctrl.ng-scope').removeClass('block').addClass('hidden');
		$('.ng-scope.addss').removeClass('hidden').addClass('block');
		$('#shopbasket').attr('style','top:-44px');
		$('#number').html(1);
		log = -44
	});

	$('.shop-cartfooter-checkout.ng-binding').click(function(){
		window.location.href = "/dingdan";
	});


	$('.shopclear').click(function(){
		$get('/shopclear');
	})



	$('.shopguide-favor').click(function(){
		// var a = 0; 
		// alert('1111');
		var a = $('a[value]').val();
		// alert(a);
		if(empty(a)) {
			// return redirect('/login');
			alert('1111');
		}
		// $(this).next().removeClass('icon-favorite').addClass('icon-unfavorite').next().;
	})
	function isid(){
	var id = $('body').attr('id');
	if(id==0){
		self.location="/login";
		}
	}
	$('.shopmenu-food.ng-isolate-scope img').each(function(){
		$(this).click(function(){
			$('#goodscenter').css('display','block');
			var sid = $(this).next().val();
			$.get('/goodscenter',{sid:sid},function(data){
				console.log(data);
				// console.log(JSON.parse(data));

				$('#shipinming').html(data[0]['goodsname']);
				$('.description.ng-binding').html(data[0]['describe']);
				$('.price.ng-binding').html(data[0]['price']);
				$('.mainimage').attr('src',data[0]['logo']);
			});
		});
	});


	function sui(){
		// isid();
		$('#goodscenter').css('display','none');
	}

	function shou(dian){
		isid();
		var did = $(dian).attr('did');
		var uid = $('body').attr('id');
		$.get('/shoucang',{did:did,uid:uid},function(data){
			console.log(data);
			if(data==1){
				$(dian).html('取消收藏');
			}else{
				$(dian).html('收藏');
			}
		})
	}